import { ZFormItemSchema } from "@/components/Form/typings";
import { LabelPlacement } from "naive-ui/es/form/src/interface";
import { ref } from "vue";

export const labelPlacement = ref<LabelPlacement>("left");

export const getSchemas = (): ZFormItemSchema[] => [
  {
    label: "假如我有一个很长的名字",
    path: "name",
    component: "NInput",
    description: "默认的描述说明信息",
  },
  {
    label: "我只占一半宽度",
    path: "word",
    span: 12,
    component: "NSelect",
    componentProps: {
      style: { width: "100%" },
      options: [
        {
          label: "左边",
          value: "left",
        },
        {
          label: "上边",
          value: "top",
        },
      ],
      onUpdateValue(value: LabelPlacement) {
        console.log(value);
        labelPlacement.value = value;
      },
    },
    description: [
      "1. 绝不意气用事",
      "2. 保证绝对公平",
      "3. 我可以在上边或者左边",
    ],
  },
  {
    label: "我喜欢在左边",
    path: "date",
    required: true,
    rule: {
      required: true,
    },
    labelAlign: "left",
    component: "NDatePicker",
  },
  {
    label: "必填在左边才酷",
    path: "enable",
    required: true,
    requireMarkPlacement: "left",
    component: "NCheckbox",
    componentModelValue: "checked",
    defaultValue: false,
  },
];
